﻿@{
    ViewBag.Title = "修改密码";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<style type="text/css">
    html,body {
        background:#eee;
        height: 100%;
        width: 100%;
        overflow:hidden;
    }

    .center {
        margin-left:auto;
        margin-right:auto;
    }

    label {
        color:#999;
        font-weight:bold;
    }

    input[type=submit] {
        width:100px;
        font-size:16px;
        font-weight:bold;
    }

    input[type=text],input[type=password] {
        width:200px;
        height:20px;
    }
</style>

<div class="center" style="margin-top:17%;padding:32px;background:white; border:1px solid #bbb;width:360px;">
    <div class="center" style="width:300px;font-weight:bold;font-size:150%;color:#904;">修改密码</div>
    <div style="height:10px;"></div>
    <div class="center" style="width:300px;">
        <form id="form1" method="post">
            <fieldset style="width:300px;">
                <legend></legend>
                <div style="padding:10px;">
                    <div><label for="Name">当前密码: </label></div>
                    <div>
                        <input id="Old" name="_old" type="password"
                                class="easyui-validatebox" data-options="required:true" />
                    </div>
                    <div style="height:10px;"></div>
                    <div><label for="New">新密码: </label></div>
                    <div>
                        <input id="New" name="_new" type="password" value="" 
                                class="easyui-validatebox" data-options="required:true" />
                    </div>
                    <div style="height:10px;"></div>
                    <div><label for="Confrim">确认密码: </label></div>
                    <div>
                        <input id="Confrim" name="_confrim" type="password" value="" 
                                class="easyui-validatebox" data-options="required:true" />
                    </div>
                    <div style="height:10px;"></div>
                    <div>
                        <input id="btnSubmit" type="submit" value="保存" />
                    </div>
                </div>                                        
            </fieldset>
        </form>
    </div>
</div>

<script type="text/javascript">
    $(form1).submit(function () {
        var regex = new RegExp('^[\@@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{4,16}$');
        if (!regex.test($('#Old').val())) {
            alert('当前密码格式不正确');
            return false;
        }

        var v1 = $('#New').val();
        if (!regex.test(v1)) {
            alert('新密码格式不正确');
            return false;
        }

        if (v1 != $('#Confrim').val()) {
            alert('两次输入密码不一致');
            return false;
        }

        return true;
    });
</script>

@if (this.ViewBag.Message != null)
{ 
<script type="text/javascript">
    $(document).ready(function () {
        alert('@ViewBag.Message');
    });    
</script>
}